Skip to content

fix(core): ignore hidden files when loading skill resources#1002

Open
jujn wants to merge 5 commits intoagentscope-ai:mainfrom
jujn:fix_1000
Open

fix(core): ignore hidden files when loading skill resources#1002
jujn wants to merge 5 commits intoagentscope-ai:mainfrom
jujn:fix_1000

Conversation

@jujn
Copy link

@jujn jujn commented Mar 20, 2026

Description

Close #1000

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

@jujn jujn requested review from a team and Copilot March 20, 2026 07:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #1000 by updating skill resource loading to ignore hidden/dot-prefixed files, preventing unwanted artifacts (e.g., .DS_Store) from being included in AgentSkill resources.

Changes:

  • Add filtering in SkillFileSystemHelper.loadResources(...) to skip dot-prefixed and hidden/unreadable files.
  • Add a unit test to verify dot-prefixed files are excluded from loaded resources.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
agentscope-core/src/main/java/io/agentscope/core/skill/util/SkillFileSystemHelper.java Adds hidden/dotfile filtering during resource discovery when loading a skill.
agentscope-core/src/test/java/io/agentscope/core/skill/util/SkillFileSystemHelperTest.java Adds coverage for filtering dot-prefixed files out of loaded resources.

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 78.37838% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ntscope/core/skill/util/SkillFileSystemHelper.java 78.37% 6 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@LearningGp
Copy link
Collaborator

@fang-tech PTAL

Copy link
Collaborator

@LearningGp LearningGp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LearningGp LearningGp mentioned this pull request Mar 24, 2026
Copy link
Contributor

@fang-tech fang-tech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DisplayName(
"Should fully cover resource filtering logic (unreadable, dot-files, OS hidden, and"
+ " IOException)")
void testLoadResources_FiltersAllEdgeCases() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split your tests into individual unit tests for each case.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! Considering that the business logic of resource filtering in this section is actually very lightweight. I understand that splitting test cases can make responsibilities more singular, but it can make the test classes cumbersome. Hope you can reconsider?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the code of the filter needs to be modified in the future, things will become complicated. We won't be able to precisely determine which aspects of the tests were made unavailable due to our modifications. You might think it's too cumbersome and could appropriately combine them. However, if all the tests are placed in one method, it will impose a burden on future modifications. This is actually a formatting task, and you can use AI to complete it quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:skill resource should filter hidden file

4 participants